import java.util.PriorityQueue;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: fzykd
 * Date: 2022-04-18
 * Time: 20:37
 */
public class TestDemo {
    public static void main2(String[] args) {
        //默认就是一个小根堆
        PriorityQueue<Integer> priorityQueue = new PriorityQueue<>();
        //每放一个元素 都得保证当前的堆 是大堆 或者是小堆
        priorityQueue.offer(12);
        priorityQueue.offer(3);
        priorityQueue.offer(15);

        System.out.println(priorityQueue.poll());
        System.out.println(priorityQueue.poll());

    }

    public static void main(String[] args) {
        int[] array = {27, 15, 19, 18, 28, 34, 65, 49, 25, 37};
        TestHeap testHeap = new TestHeap();
        testHeap.createHeap(array);
        testHeap.offer(80);
        System.out.println("=================");
        System.out.println(testHeap.poll());//80
        System.out.println(testHeap.poll());//65

    }
}
